//
//  UILable.swift
//  weibo
//
//  Created by apple on 16/2/20.
//  Copyright © 2016年 apple. All rights reserved.
//

import UIKit

extension UILabel {
    
    //类工厂方法 
    // ->  UILable 返回值类型
    class func factoryLable(text: String,fontSize: CGFloat,textColor:UIColor) ->UILabel {
        
        let l = UILabel()
        l.text = text
        l.font = UIFont.systemFontOfSize(fontSize)
        l.textColor = textColor
        
        //设置行
        l.numberOfLines = 0
        //对齐方式
        l.textAlignment = .Center
        //自适应大小
        l.sizeToFit()
        return l
    }

    convenience init(text: String,fontSize: CGFloat,textColor:UIColor) {
    
        self.init()
        
        self.text = text
        font = UIFont.systemFontOfSize(fontSize)
        self.textColor = textColor
        //设置行数为 0
        numberOfLines = 0
        //设置对其
        textAlignment = .Center
        //自适应大小
        sizeToFit()
    }

}
